Skip to content

feat: Add skeleton loading support to table#4583

Merged
gethinwebster merged 1 commit into
mainfrom
dev-v3-gethinw-table-skeleton
Jun 9, 2026
Merged

feat: Add skeleton loading support to table#4583
gethinwebster merged 1 commit into
mainfrom
dev-v3-gethinw-table-skeleton

Conversation

@gethinwebster

Copy link
Copy Markdown
Member

Add skeleton prop ({ totalRows: number }) that renders skeleton placeholder rows to fill the table while data is loading.

  • skeleton.totalRows defines total visible rows (typically page size)
  • Skeleton rows rendered = max(0, totalRows - items.length)
  • Standard loading: items=[] + loading=true + skeleton -> all skeleton rows
  • Progressive loading: items=[partial] + skeleton -> real rows + trailing skeleton
  • A11y: visually-hidden row with ScreenreaderOnly loadingText before skeleton rows
  • Skeleton rows use aria-hidden=true
  • Includes interactive demo pages for both patterns

Description

Related links, issue #, if available: n/a

How has this been tested?

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@gethinwebster gethinwebster force-pushed the dev-v3-gethinw-table-skeleton branch from 6681d62 to 465f073 Compare June 5, 2026 06:50
@gethinwebster gethinwebster force-pushed the dev-v3-gethinw-table-skeleton branch from 465f073 to 58e6f84 Compare June 5, 2026 07:02
@gethinwebster gethinwebster force-pushed the dev-v3-gethinw-table-skeleton branch from 58e6f84 to 14ad9b9 Compare June 5, 2026 07:12
@gethinwebster gethinwebster force-pushed the dev-v3-gethinw-table-skeleton branch from 14ad9b9 to fa974ca Compare June 5, 2026 08:01
@gethinwebster gethinwebster force-pushed the dev-v3-gethinw-table-skeleton branch from fa974ca to b98f8db Compare June 5, 2026 08:18
@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.50%. Comparing base (ddbb532) to head (ff19e2c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4583   +/-   ##
=======================================
  Coverage   97.50%   97.50%           
=======================================
  Files         947      948    +1     
  Lines       30248    30262   +14     
  Branches    11021    11027    +6     
=======================================
+ Hits        29493    29507   +14     
  Misses        708      708           
  Partials       47       47           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread src/table/skeleton-row.tsx Outdated
Comment thread src/table/internal.tsx Outdated
</td>
</tr>
{Array.from({ length: skeleton.totalRows }, (_, rowIndex) => (
<SkeletonRow

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block and the one below look similar and have a lot in common, can we extract them to avoid repetetion.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extracted

Comment thread src/table/internal.tsx Outdated
{Array.from({ length: Math.max(0, skeleton.totalRows - allItems.length) }, (_, rowIndex) => (
<SkeletonRow
key={`skeleton-row-${rowIndex}`}
rowIndex={rowIndex + 1}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand 1 here to the rowIndex?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the naming so it's clearer what's going on

Comment thread src/table/skeleton-row.tsx Outdated
resizableColumns,
colIndexOffset,
}: SkeletonRowProps) {
const isFirstRow = rowIndex === 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following up: https://github.com/cloudscape-design/components/pull/4583/changes#r3379168550
If we do the +1 to row index then I think this would not be true

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be true in the other code path (when only skeleton rows are displayed), but have updated naming so hopefully the logic is clearer now

Add skeleton prop ({ totalRows: number }) that renders skeleton placeholder
rows to fill the table while data is loading.

- skeleton.totalRows defines total visible rows (typically page size)
- Skeleton rows rendered = max(0, totalRows - items.length)
- Standard loading: items=[] + loading=true + skeleton -> all skeleton rows
- Progressive loading: items=[partial] + skeleton -> real rows + trailing skeleton
- A11y: visually-hidden row with ScreenreaderOnly loadingText before skeleton rows
- Skeleton rows use aria-hidden=true
- Includes interactive demo pages for both patterns
@gethinwebster gethinwebster added this pull request to the merge queue Jun 9, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 9, 2026
@gethinwebster gethinwebster added this pull request to the merge queue Jun 9, 2026
Merged via the queue into main with commit 22d5a6b Jun 9, 2026
87 of 88 checks passed
@gethinwebster gethinwebster deleted the dev-v3-gethinw-table-skeleton branch June 9, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants